local requestTotalCount = tonumber(redis.call('hget', KEYS[1], "total"));
local requestPassCount = tonumber(redis.call('hget', KEYS[1], "pass"));
local requestDayTotalCount = tonumber(redis.call('hget', KEYS[2], "total"));
local requestDayPassCount = tonumber(redis.call('hget', KEYS[2], "pass"));

if type(requestDayTotalCount) == 'nil' then
    redis.call('hset', KEYS[2], "total", ARGV[1]);
    redis.call('expire', KEYS[2], 172800);
else
    redis.call('hincrby', KEYS[2], "total", ARGV[1]);
end
if type(requestDayPassCount) == 'nil' then
    redis.call('hset', KEYS[2], "pass", ARGV[2]);
    redis.call('expire', KEYS[2], 172800);
else
    redis.call('hincrby', KEYS[2], "pass", ARGV[2]);
end

if type(requestTotalCount) == 'nil' or type(requestPassCount) == 'nil' then
    return -1;
else
    redis.call('hincrby', KEYS[1], "total", ARGV[1]);
    redis.call('hincrby', KEYS[1], "pass", ARGV[2]);
    return 1;
end